package com.zzl.java8.lambda6;

import java.util.Objects;

/**
 * description: 为测试lambda表达式而设计的实体类
 * @author 朱正磊
 * @date 2020-04-21 16:13:02
 */
@SuppressWarnings("ALL")
public class Person {

    private Integer age;

    private String name;

    private String gender;

    public Person() {

    }

    public Person(String name) {
        this.name = name;
    }

    public Person(String name, String gender) {
        this.name = name;
        this.gender = gender;
    }

    public Person(Integer age, String name, String gender) {
        this.age = age;
        this.name = name;
        this.gender = gender;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public Person toOpposite() {
        this.setGender(Objects.equals(this.gender, "Male") ? "Female" : "Male");
        return this;
    }

    public static Boolean isTest() {
        return true;
    }

    public static Boolean isMale(Person person) {
        return Objects.equals(person.getGender(), "Male");
    }

    public Boolean isMale2() {
        return Objects.equals(this.gender, "Male");
    }

    public Boolean isUnder(Person person) {
        return person.age > this.age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", gender='" + gender + '\'' +
                '}';
    }

}
